package mathive.client;

import mathive.client.panels.ChangePassPanel;
import mathive.client.panels.ContactPanel;
import mathive.client.panels.CreateTestPanel;
import mathive.client.panels.ForgotPassPanel;
import mathive.client.panels.GamesPanel;
import mathive.client.panels.HomePanel;
import mathive.client.panels.ManageTestsPanel;
import mathive.client.panels.RegisterPanel;
import mathive.client.panels.ResultsPanel;
import mathive.client.panels.TestsPanel;
import mathive.client.panels.UserListPanel;

import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class PanelHandler {

	private static VerticalPanel mainPanel;
	private static HomePanel homePanel;
	private static GamesPanel gamesPanel;
	private static TestsPanel testsPanel;
	private static ContactPanel contactPanel;
	private static ResultsPanel resultsPanel;
	private static RegisterPanel registerPanel;
	private static ForgotPassPanel forgotPassPanel;
	private static ChangePassPanel changePassPanel;
	private static CreateTestPanel createTestPanel;
	private static SudokuCreator createSudokuPanel;
	private static UserListPanel userListPanel;
	private static ManageTestsPanel manageTestsPanel;
		
	public static void initialize(VerticalPanel main, HomePanel home, GamesPanel games, 
			TestsPanel tests, ContactPanel contact, ResultsPanel results, RegisterPanel register,
			ForgotPassPanel forgotPass, ChangePassPanel changePass, CreateTestPanel createTest,
			SudokuCreator createSudoku, UserListPanel userList, ManageTestsPanel manageTests){
		mainPanel = main;
		homePanel = home;
		gamesPanel = games;
		testsPanel = tests;
		contactPanel = contact;
		resultsPanel = results;
		registerPanel = register;
		forgotPassPanel = forgotPass;
		changePassPanel = changePass;
		createTestPanel = createTest;
		createSudokuPanel = createSudoku;
		userListPanel = userList;
		manageTestsPanel = manageTests;
	}

	public static void showHome(){
		mainPanel.clear();
		mainPanel.add(homePanel.getPanel());
	}

	public static void showGames(){
		mainPanel.clear();
		mainPanel.add(gamesPanel.getPanel());
	}

	public static void showTests(){
		mainPanel.clear();
		mainPanel.add(testsPanel.getPanel());
	}

	public static void showContact(){
		mainPanel.clear();
		mainPanel.add(contactPanel.getPanel());
	}

	public static void showResults(String title, String gameId, int result){
		resultsPanel.showResult(title, gameId, result);
		mainPanel.clear();
		mainPanel.add(resultsPanel.getPanel());
	}
	
	public static void showRegister(){
		mainPanel.clear();
		mainPanel.add(registerPanel.getPanel());
	}
	
	public static void showForgotPassword(){
		mainPanel.clear();
		mainPanel.add(forgotPassPanel.getPanel());
	}
	
	public static void showChangePassword(){
		mainPanel.clear();
		mainPanel.add(changePassPanel.getPanel());
	}
	
	public static void showCreateTest(){
		mainPanel.clear();
		mainPanel.add(createTestPanel.getPanel());
	}
	
	public static void showCreateSudoku(){
		mainPanel.clear();
		mainPanel.add(createSudokuPanel.getPanel());
	}
	
	public static void showUserList(){
		mainPanel.clear();
		mainPanel.add(userListPanel.getPanel());
	}
	
	public static void showManageTests(){
		mainPanel.clear();
		mainPanel.add(manageTestsPanel.getPanel());
	}
}
